﻿@model ZingBlog.Domain.Entities.DiarysEntity
@{
    ViewBag.Title = "Edit";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutForm.cshtml";
}

<div class="layui-col-md12 top10">
    <form class="layui-form" id="form" action="/Blog/Diarys/Edit" method="post">
        <input name="Id" value="@Model.Id" type="hidden">
        @Html.HiddenFor(x => x.CreateOn)
        <div class="layui-form-item">
            <label class="layui-form-label">日记</label>
            <div class="layui-input-block">
                <textarea id="Content"  name="Content" lay-verify="concact">@Model.Content</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="submitForm" id="submitForm">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layedit'], function () {
        var form = layui.form;
        var layedit = layui.layedit;
        var $ = layui.$;
        layedit.set({
            uploadImage: {
                url: '/SysSet/Info/ExportFile/' //接口url
                , type: 'post' //默认post
            }
        });
        form.verify({
            concact: function (value, item) { //value：表单的值、item：表单的DOM对象
                layedit.sync(index);
            }
        })
        var index = layedit.build('Content'); //建立编辑器
        //富文本框不知道怎么验证，所以还是用了母版页的监听
        submitForm(form, "编辑成功"); //监听提交
    });
</script>

